<?php
namespace yan\currency;
abstract class AbstractFactory{
    private static $_instances = [];

    public static function instance($refresh = false){
        $className = get_called_class();
        if($refresh || empty(self::$_instances[$className])){            
            self::$_instances[$className] = new $className();
        }
        return self::$_instances[$className];
    }
}